<layout name="layout" />
 <div class="main-title">
	  <div class="fr">
		 <form>
			<input type="text" name="keyword" class="input input-200" value="{$keyword}">
			<input type="submit" value="搜索" class="btn btn-main">
		  </form>
	  </div>
 </div>
  <div class="main-content">
	 <div class="main-content-title">
	    {:URL('增加','add',array('icon'=>'add'))}
	    {:URL('排序','##',array('icon'=>'listorder','class'=>'listorder'))}
	 
		<ul class="ul-list-row">
		     <volist name="sortList" id="vo">
		    	 <li class="tac"><a href="{:U('Ads/lis',array('sortid'=>$vo['sort_id']))}" <?php if($sortid == $vo['sort_id'])echo 'style="color:red"';?>>{$vo.sort_title}</a></li>
		     </volist>
		 
		 </ul>
		 
	  </div>
	  <div class="main-content-body">
	   <form action="" method="post" id="form001">	  
		  <table class="table-list" >
		  <thead>
			<tr>
			  <td width="5%">序列号</td>
			  <td width="5%">类别</td>
			  <td width="15%">标题</td>
			  <td width="10%">连接地址</td>
			  <td width="10%">更新时间</td>
			  <td width="20%">操作</td>
			  <td></td>
			</tr>
		</thead>
		<tbody>
		  <volist  name="dataList" id="vo">
			<tr>
			   <td><input type="text" name='listorder[{$vo.id}]' value="{$vo.listorder}" class="w50"></td>
			   <td>{$vo.sort_id}</td>
			   <td>{$vo.title}{$vo.usable|usable}{$vo.image|hasImage}</td>
			   <td>{$vo.link}</td>
			   <td>{$vo.update_time|toDate}</td>
			   <td>
			   {:URL('编辑','edit',array('parame'=>array('primarykey'=>$vo['id']),'icon'=>'edit'))}
			   {:URL('删除','del',array('parame'=>array('primarykey'=>$vo['id']),'icon'=>'del'))}
			   <?php if($vo['usable'])echo URL('关','###',array('icon'=>'close','attr'=>array('dataid'=>$vo['id'])));else echo URL('开','###',array('icon'=>'open','attr'=>array('dataid'=>$vo['id'])));?>
			   </td>
			   <td></td>
			</tr>
		</volist> 
		 <tr><notpresent name="dataList"><td colspan="10" class="text-warning tac">没有数据</td></notpresent></tr>
		</tbody>
		  </table>	
	  </form>
	 </div>
	   <script>
	    $(function(){
	    	$('.listorder').on('click',function(){
	    		   var apiUrl = "{:U('listorder')}";
	    		   changeListorder(apiUrl,'form001');
	    		   return false;
	    	});
	    	$('.open-icon').on('click',function(){
	    		var id = $(this).parent('a').attr('dataid');
	    		
	    		var apiUrl = "{:U('change_status')}";
	    		changeStatus(apiUrl,{usable: 1,id: id});
	    		 return false;
	    	});
	    	$('.close-icon').on('click',function(){
	    		var id = $(this).parent('a').attr('dataid');
	    		
	    		var apiUrl = "{:U('change_status')}";
	    		changeStatus(apiUrl,{usable: 0,id: id});
	    		 return false;
	    	});
	    	
	    })
	    
	    
	  </script>
	</div>	